// JavaScript Document

function getEl (id) {
	var obj = null;
	if (!document.getElementById) return false;
	if (!(obj =document.getElementById(id))) return false;
	return obj;
}

function toggleSpanColor (id, status) {
	var tmpObj;
	var className = 'field' + status ;
	if (tmpObj = getEl('span_' + id)) tmpObj.className = className;
}

function CheckKeyPress (e,codeS) {
	var code;
	if (!e) var e = window.event;
	if (e.keyCode) code = e.keyCode;
	else if (e.which) code = e.which;
	if (code==codeS) {
		return true;
	}
	return false;
}

function simClick (id) {
	var tmpObj;
	if (tmpObj = getEl(id)) tmpObj.click();
}

	
function getCheckDetails (value, mode, dataArray) {
	var string = '<tr valign="top"><td nowrap>';
	string += '<strong>Checks will be <br>';
	if (mode == 'pay') string += 'PAID';
	else if (mode == 'mail') string += 'MAILED';
	string += ' to:</strong>';
	//if (mode == 'mail') string += '<br><a href="#">change mailing<br>details</a>';
	string += ' </td><td width="100%">';
	if (value == 'company') string += '<span style="cursor: help" title="This is your company name">' + dataArray['company_name'] + '</span>';
	else if (value == 'fullname')  string += '<span style="cursor: help" title="This is your full name">' + dataArray['first_name'] + ' ' + dataArray['last_name'] + '</span>';
	string += '<br>';
	string += '<span style="cursor: help" title="This is your address line 1">' + dataArray['address1'] + '</span><br>';
	if (dataArray['address2']) string += '<span style="cursor: help" title="This is your address line 2">' + dataArray['address2'] + '</span><br>';
	string += '<span style="cursor: help" title="These are your city, state, ZIP code">' + dataArray['city'] + ', ' + dataArray['state'] + ' ' + dataArray['zip'] + '</span><br>';
	string += '<span style="cursor: help" title="This is your country">' + dataArray['country'] + '</span><br>';
	string += '</td></tr>';
	return string;
}